<?php
/**
 * User: wufeng
 * Date: 2019/4/17
 * Time: 17:55.
 */

namespace app\xcxapi\validate;

use think\Validate;

class CustomerValidate extends Validate
{
    protected $rule = [
		'phone' => 'regex:1[3-9]\d{9}|require|unique:edu_student,campus_id^phone',
		'id' => 'require|integer',
    ];

    protected $message = [
		'phone.require' => '手机号码不能为空',
		'phone.regex' => '手机号错误',
		'phone.unique' => '手机号已存在',
		'id.require' => '客户ID不能为空',
		'id.integer' => '客户ID类型错误',
    ];

    protected $scene = [
		'customer' => ['id'],
        'addCustomer' => ['phone'],
        'editCustomer' => ['id','phone'],
    ];
}
